﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;

namespace 工业设备监控系统.BLL
{
    public static class LedIndicator
    {
        public static System.Drawing.Image Create(Color color, int size = 20)
        {
            var bitmap = new Bitmap(size, size);
            using (var g = Graphics.FromImage(bitmap))
            {
                // 抗锯齿
                g.SmoothingMode = SmoothingMode.AntiAlias;
                // 画圆
                var rect = new Rectangle(1, 1, size - 3, size - 3);
                g.FillEllipse(new SolidBrush(color), rect);
                // 加个高光（可选，更真实）
                var highlight = new Rectangle(3, 3, size / 4, size / 4);
                g.FillEllipse(Brushes.White, highlight);
            }
            return bitmap;
        }

        // 预定义图像
        public static System.Drawing.Image Green => Create(Color.Green);

        public static System.Drawing.Image Yellow => Create(Color.Orange);
        public static System.Drawing.Image Red => Create(Color.Red);
        public static System.Drawing.Image Gray => Create(Color.Gray);
    }
}